package com.wpml;

public class StackSOFDemo {
    private int length = 1;

    public void stackLeak() {
        length++;
        stackLeak();
    }

    // -Xss128k  java.lang.StackOverflowError
    // win10 jdk1.8 stack大小 默认108k
    public static void main(String[] args) throws Throwable{
        StackSOFDemo stackSOFDemo = new StackSOFDemo();
        try {
            stackSOFDemo.stackLeak();
        } catch (Throwable e) {
            System.out.println("stack length: " + stackSOFDemo.length);
            throw e;
        }
    }
}
